/**
* PermissionSpecificator.cs
**/
using System;
using System.Collections.Generic;

using Yawf.Security.Entities;
using Yawf.Core.Exceptions;

namespace Yawf.Security {
	public class AuthorizationException : YawfException {

		public IUser User { get; private set; }
		public String Resource { get; private set; }

		/**
		* Constructor user and resource
		* 
		* @param user - user that has no permission
		* @param resource - resource that user has no permission to
		**/

		public AuthorizationException(IUser user, String resource)
			: base("Access denied for resource: " + resource) {
			User = user;
			Resource = resource;
		}

		/**
		* Constructor with mesage
		* 
		* @param user - user that has no permission
		* @param resource - resource that user has no permission to
		* @param e - Exceeption that has occured
		**/
		public AuthorizationException(IUser user, String resource, Exception e)
			: base("No permission to obtain resource " + resource, e) {
			User = user;
			Resource = resource;
		}
	}

}